package com.wego.common.enumeration;

public enum ResultEnum {
    /* 成功 */
    SUCCESS(200, "操作成功"),
    INSERT_SUCCESS(201, "新增成功"),
    UPDATE_SUCCESS(202, "更新成功"),
    DELETE_SUCCESS(203, "删除成功"),
    UPLOAD_SUCCESS(204, "上传成功"),
    DOWNLOAD_SUCCESS(205, "下载成功"),
    LOGIN_SUCCESS(206, "登陆成功"),
    LOGOUT_SUCCESS(207, "登出成功"),
    DATA_FIND_SUCCESS(208, "数据查询成功"),

    /**
     * 失败
     */
    BAD_REQUEST(400, "错误的请求"),
    NOT_FOUND(404, "资源不存在"),
    NOT_ACCEPTABLE(406, "服务端不扶持所需表示"),
    common_conflict(409, "通用冲突"),

    VERIFY_CODE_IS_NULL(410, "验证码不能为空！"),
    VERIFY_CODE_IS_ERROR(411, "验证码不正确！"),

    /* 系统异常 */
    SYSTEM_EXCEPTION(500, "系统异常"),
    SYSTEM_BUSY_EXCEPTION(510, "系统繁忙，请稍后重试"),
    UNKNOWN_EXCEPTION(501, "未知异常"),
    SERVICE_EXCEPTION(502, "服务异常"),
    DATABASE_EXCEPTION(503, "数据库操作异常"),
    INSERT_EXCEPTION(504, "新增错误"),
    UPDATE_EXCEPTION(505, "更新错误"),
    DELETE_EXCEPTION(506, "删除错误"),
    UPLOAD_EXCEPTION(507, "上传错误"),
    DOWNLOAD_EXCEPTION(508, "下载错误"),
    DATA_FIND_EXCEPTION(509, "查找不到对应的数据"),
    SERVICE_UNAVAILABLE(510, "服务当前无法处理请求"),

    /*用户错误*/
    USER_NOT_LOGIN(600, "用户未登录，请先登录"),
    USER_LOGIN_ERROR(601, "用户不存在或密码错误"),
    USER_ACCOUNT_FORBIDDEN(602, "账号已被禁用"),
    USER_NOT_EXIST(603, "用户不存在"),
    USER_HAS_EXISTED(604, "用户已经存在"),
    USER_LOGIN_EXPIRE(605, "用户登陆过期"),
    USER_ACCESS_LIMITED(606, "用户访问受限"),
    ONLINE_USER_OVER(607, "在线用户数超出允许登录的最大用户限制"),
    USER_REGISTER_SUCCESS(608, "注册成功"),
    USER_REGISTER_EXCEPTION(609, "注册失败"),

    /* 参数错误 */
    PARAM_ERROR(700, "参数错误"),
    PARAM_IS_INVALID(701, "参数无效"),
    PARAM_IS_BLANK(702, "参数为空"),
    PARAM_BIND_ERROR(703, "参数绑定错误"),
    PARAM_NOT_COMPLETE(704, "参数缺失"),

    /* Token */
    PERMISSION_TOKEN_EXPIRED(800, "token已过期"),
    PERMISSION_TOKEN_INVALID(801, "无效token"),
    PERMISSION_SIGNATURE_ERROR(802, "签名失败");


    /**
     * 操作代码
     */
    int code;
    /**
     * 提示信息
     */
    String msg;

    ResultEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int code() {
        return code;
    }

    public String msg() {
        return msg;
    }
}
